<script>
  import { Route, Link } from "svelte-routing";
  import Profile from "./Profile.svelte";
  import Settings from "./Settings.svelte";
</script>

<div class="user-layout">
  <h2>用户中心</h2>
  <nav>
    <Link to="/user/profile">个人资料</Link>
    <Link to="/user/settings">设置</Link>
  </nav>

  <!-- 嵌套路由 -->
  <Route path="profile" component={Profile} />
  <Route path="settings" component={Settings} />
  <!-- 默认显示 Profile -->
  <Route path="" component={Profile} />
</div>

<style>
  .user-layout {
    padding: 20px;
    border: 1px solid #ccc;
  }
  nav a {
    margin-right: 10px;
  }
</style>
